Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CP-4207: Fix crash when starting a swap then switch to send #509

Merged
merged 2 commits into from
Dec 2, 2022

Conversation

atn4z7
Copy link
Collaborator

@atn4z7 atn4z7 commented Dec 2, 2022

What does this PR accomplish?

there are a couple of things involved here:

  • the crash is caused by Promise.allSettled is not a function
  • currently, we have multiple sources overriding the global Promise module at app start. some of them don't support allSettled.
    • react native
    • sentry
    • web3-providers-http via paraswap
    • us manually calling require('promise.allsettled').shim() and import 'es6-promise/auto'

the fix:

  • patch web3-providers-http to not override the Promise module with es6-promise. es6-promise is meant for IE9 so it is not necessary for us.
  • make sure we don't call require('promise.allsettled').shim() and import 'es6-promise/auto' anymore
  • update react native to 0.70.6, which adds support for Promise.allSettled out of the box.

references:
https://github.com/facebook/react-native/blob/v0.70.6/Libraries/Core/polyfillPromise.js
https://github.com/getsentry/sentry-react-native/blob/4.8.0/src/js/integrations/reactnativeerrorhandlers.ts
facebook/react-native#35080
https://github.com/web3/web3.js/blob/1.x/packages/web3-providers-http/src/index.js#L32
https://docs.sentry.io/platforms/react-native/troubleshooting/#auto-patching-default-behavior

@atn4z7 atn4z7 requested a review from neven-s December 2, 2022 19:37
Copy link
Collaborator

@neven-s neven-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one!

@neven-s neven-s merged commit deb2643 into development Dec 2, 2022
@neven-s neven-s deleted the cp-4207 branch December 2, 2022 23:37
@atn4z7 atn4z7 mentioned this pull request Dec 13, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants